package com.han.fu.api.business.enums;

import lombok.Getter;

/**
 * 角色枚举
 *
 * @author: star.zhu
 * @date: 2021-08-03
 */
public enum RoleEnum {
    /**
     * 角色
     */
    TOURIST("tourist", "游客"),
    MEMBER("member", "会员"),
    ADMIN("admin", "管理员");

    @Getter
    private String code;

    @Getter
    private String desc;

    RoleEnum(String code, String desc) {
        this.code = code;
        this.desc = desc;
    }

    public static String getDesc(String code) {
        for (RoleEnum anEnum : values()) {
            if (anEnum.code.equals(code)) {
                return anEnum.getDesc();
            }
        }
        return null;
    }
}
